package com.ss.SmartStock.mapper;

import com.ss.SmartStock.pojo.entity.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-06-17
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    /**
     * 查询所有基本商品信息
     */
    @Select("select * from product")
    List<Product> selectAllProduct();

    /**
     * 根据商品详情表id查找商品基本信息
     */
    @Select("select * from product where product_details_id={id}")
   Product selectProductBypdid(Long id);

    /**
     * 根据操作人id查询所有商品基本信息
     * @param id
     * @return
     */
    @Select("select * from product where operator={id}")
    List<Product> selectAllProductById(Long id);

    @Select("select  * from product where product_details_id = {productDetailId}")
    Product getByDetailId(Long productDetailId);
}
